/**
 * Created by ZHOUSH on 1/6/2016.
 */
var foundClz = function (dom, filter) {
    return dom.className.split(/\s+/ig).filter(filter);
};
dashboard.controller('monitorController', function ($scope, $http) {
    $scope.criteria = {
        select: ['B'],
        cb0: [true],
        cb1: [true]
    };
    $scope.layout = {
        frame: false,
        size: [12, 9],
        panels: [{
            heading: 'Category',
            size: [2, 9]
        }, {
            frame: false,
            size: [10, 9],
            panels: [
                {
                    heading: 'Criteria',
                    size: [10, 2]
                },
                {
                    heading: 'Result',
                    size: [10, 7]
                }
            ]
        }]
    };
    $scope.modal = {
        frame: false,
        size: [12, 8],
        panels: [{
            heading: "test",
            size: [6, 8],
            form: {
                data: {},
                dataSources: [
                    'TEST1',
                    'TEST1'],
                fields: [
                    '[@dataSource,block]Data Source=>listview,@dataSources,box,200px',
                    '-',
                    '[buttons,right]=>button,Add|button,Remove|button,New'
                ]
            },
            items: [
                'form=>@panel.form'
            ]
        }, {
            heading: "test",
            size: [6, 8],
            form: {
            },
            items: [
                'form=>@panel.form'
            ]
        }]
    };
    var rc = function (panel) {
        if (panel.panels) {
            panel.panels.forEach(function (item) {
                item.parent = panel;
                rc(item);
            })
        }
    };
    rc($scope.layout);
    $scope.ds_arr = [];
    $scope.dataSourcePanel = {
        options: $scope.ds_arr,
        data: {},
        fields: [
            'Module=>text',
            '[@type]Type=>select',
            '[buttons,right]=>button,Save|button,Cancel'
        ]
    }
});